TestCase
(
	'org.puremvc.js.help.adapters.FacadeAdapterTest'

,	{
		testPrototypeChain: function ()
		{
			// subclass FacadeAdapter
			function Subclass () {};
			Subclass.prototype= new FacadeAdapter;
			Subclass.prototype.constructor= Subclass;
			
			assertInstanceOf('instances of FacadeAdapter qualify as instances of Facade', Facade, new FacadeAdapter);
			assertInstanceOf('instances of objects chained to FacadeAdapter qualify as instances of Facade', Facade, new Subclass);
		}
		
		/**
		 * Tests a basic implementation of Facade, using a mock ApplicationFacade.
		 * The ApplicationFacade paradigm is most commonly used in PureMVC applications
		 */
	,	___testMockApplicationFacade: function ()
		{
			// TODO resolve issue with ApplicationFacade in this test, and re-implement the test
			var noteName= 'noteName'
			,	noteBody= {}
			,	noteType= 'noteType'
			,	dispatchedNoteName= 'notSent'
			,	dispatchedNoteBody
			,	dispatchedNoteType
			,	notifierFacade
			
			///////////////////////////////////
			
			MockSimpleCommand.prototype= new SimpleCommandAdapter;
			MockSimpleCommand.prototype.constructor= MockSimpleCommand;
			
			
			/** @override */
			MockSimpleCommand.prototype.execute= function (note)
			{
				console.dir(note);
				dispatchedNoteName= note.getName();
				dispatchedNoteBody= note.getBody();
				dispatchedNoteType= note.getType();
				notifierFacade= this.facade;
			};
			
			/**
			 * @constructor
			 * @extends {SimpleCommand}
			 */
			function MockSimpleCommand ()
			{
				SimpleCommand.call(this);
			};
			
			///////////////////////////////////
						
			MockApplicationFacade.prototype= new FacadeAdapter;
			MockApplicationFacade.constructor= MockApplicationFacade;
			
			/**
			 * @constructor
			 * @extends {Facade}
			 */
			function MockApplicationFacade ()
			{
				this.initializeFacade();
			};
			
			///////////////////////////////////
			
			var application= Facade.getInstance(); //new MockApplicationFacade();
			assertInstanceOf('The application facacde is an instance of Facade', Facade, application);
			assertInstanceOf('The application facacde is an instance of ApplicationFacade', MockApplicationFacade, application);
			
			application.registerCommand(noteName, MockSimpleCommand);
			assertTrue('The application has registered the command', application.hasCommand(noteName));
			
			application.sendNotification(noteName, noteBody, noteType);
			//assertSame('The notification was sent (name)', noteName, dispatchedNoteName);
			//assertSame('The notification was sent (body)', noteBody, dispatchedNoteBody);
			//assertSame('The notification was sent (type)', noteType, dispatchedNoteType);
			//assertNotSame('The application facade is not the notifierFacade', application, notifierFacade);
			assertSame('The notifierFacade is the Facade instance facade', Facade.getInstance(), notifierFacade);
		}
	}
);
